package com.xiaobai.inner_class;

/**
 * @author wangtw
 * @ClassName OutSide
 * @description: 内部类测试
 * @date 2023/1/2010:41
 */
public abstract class Outside {

    private Integer age = 18;

    static String staticValue = "外部类静态域";

    /**
     * 内部枚举
     */
    public enum OutsideEnum {

        ONE("one", "1"),

        TWO("two", "2"),

        ;

        final String label;

        final String value;

        /**
         * 定义全参构造方法
         * @param label
         * @param value
         */
        OutsideEnum(String label, String value) {
            this.label = label;
            this.value = value;
        }

        /**
         * get方法
         * @return
         */
        public String getLabel() {
            return label;
        }

        public String getValue() {
            return value;
        }
    }

    /**
     * 成员内部类
     */
    public class Inner {

        private String msg = "Hello World";

        private Integer age = 20;

        public String getMsg() {
            return msg;
        }

        public void innerTest() {
            System.out.printf("内部类msg:%s", msg);
            System.out.println();
            System.out.printf("外部类age:%s", Outside.this.age);
            System.out.println();
            System.out.printf("内部类age:%s", this.age);
            System.out.println(staticValue);
        }
    }

    /**
     * 静态内部类
     */
    public static class StaticInner {
        private String msg = "静态内部类";

        public void staticInnerTest() {
            System.out.printf("静态内部类msg:%s, 外部类静态成员变量值：%s", msg, staticValue);

        }
    }

    /**
     * 抽象方法
     */
    public abstract void testInnerClass();
}
